<template>
	<view class="outside" @click="handlerClick">
		<!-- <checkbox-group @change="checkedChange">
			<checkbox :checked="checked" :color="'#b9ac90'" value="true"></checkbox>
		</checkbox-group> -->
		<image :src="checked?checkedList[1]:checkedList[0]" class="checked"></image>
		<image :src="img" mode="widthFix" class="image"></image>
		<view class="content">
			<view class="title">{{title}}</view>
			<view class="row">
				<view class="key">活动时间：</view>
				<view class="value">{{dateString}}</view>
			</view>
			<view class="row">
				<view class="key">活动地点：</view>
				<view class="value">{{location}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			index: Number,
			id: String,
			img: String,
			title: String,
			dateString: String,
			location: String,
		},
		data() {
			return {
				checkedList: [
					'../../static/ractivity_selectbox_unselected@2x.png',
					'../../static/ractivity_selectbox_selected@2x.png'
				],
				checked: false,
				color: this.status == 0 ? "#007AFFdd" : (this.status == 1 ? "#4CD964dd" : "#eeeeeedd"),
			}
		},
		methods: {
			handlerClick() {
				this.checked = !this.checked
				this.$emit('checkedChange', this.index, this.checked)
			},
			checkedChange(e) {
				// console.log(e.detail.value[0])
				this.$emit('checkedChange', this.index, e.detail.value[0])
			}
		},
		computed: {
			cssProps() {
				return {
					'--background-color': this.color
				}
			}
		}
	}
</script>

<style>
	.outside {
		padding: 15rpx;
		height: 200rpx;
		width: calc(100% - 30rpx);
		display: flex;
		align-items: center;
	}

	.outside .checked {
		width: 40rpx;
		height: 40rpx;
		margin:0 30rpx 0 20rpx;
	}

	.outside .image {
		border-radius: 5rpx;
		height: 100%;
		width: 300rpx;
	}

	.content {
		/* height: 100%; */
		width: auto;
		margin-left: 15rpx;
	}

	.title {
		max-height: 80rpx;
		height: auto;
		line-height: 40rpx;
		/* width: 100%; */
		max-width: 400rpx;
		overflow: hidden;
		font-size: 24rpx;
		text-overflow: ellipsis;
		color: #333;
	}

	.row {
		width: 100%;
		height: auto;
		display: flex;
		font-size: 16rpx;
		margin-top: 10rpx;
	}

	.key {
		width: 120rpx;
		height: 32rpx;
		font-size: 24rpx;
		line-height: 32rpx;
		color: #666;
	}

	.value {
		width: auto;
		height: 32rpx;
		font-size: 24rpx;
		color: #999;
		line-height: 32rpx;
	}
</style>
